<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/layui/css/layui.css"
	media="all" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/resources/layui/layui.js"></script>
<style>
.layui-inline {
	padding: 10px;
}

.layui-btn {
	margin: auto;
	display: block;
	width: 100px;
}
</style>

<body>
	<form class="layui-form">
		<input type="hidden" id="caseNo" value="${caseNo }">
		<c:forEach items="${list}" var="list">
			<div class="layui-inline">
				<label class="layui-form-label">${list.doorNum }号：</label>
				<div class="layui-input-inline" style="width: 100px; float: left;">
					<span
						style="position: absolute; right: 10px; top: 10px; color: #968e8e;">￥</span>
					<input type="text" name="${list.id }" id="${list.doorNum }"
						value="${list.goodsPrice }" placeholder="￥" autocomplete="off"
						class="layui-input">
				</div>
			</div>
		</c:forEach>
		<a class="layui-btn" id="submit" lay-submit lay-filter="postPrice">提交</a>
	</form>
	<script type="text/javascript">
			layui.use(['jquery', 'layer', 'form'], function() {
				var form = layui.form,
					layer = parent.layer === undefined ? layui.layer : top.layer,
					$ = layui.$;


				form.on('submit(postPrice)', function(data) {
					// console.log(data.field)
					var arr = $("form").serializeArray();
					var prices = "";
					var key = "";

					$.each(arr, function(i, field) {
						prices = prices + field.value + ",";
						key = key + field.name + ",";

					})

					$.post("/goods/postPrice?", {
							prices: prices,
							ids: key,
							caseNo: $("#caseNo").val()
						},
						function(res) {

							layer.msg(res.message)
							parent.window.location.reload();
						})

				})

			})
		</script>
</body>

</html>